package com.UnionPayCenter.service.serviceImpl;


import com.UnionPayCenter.constant.ConstantInterface;
import com.UnionPayCenter.entity.*;
import com.UnionPayCenter.entity.vo.UserVo;
import com.UnionPayCenter.enums.ErrorCodeEnum;
import com.UnionPayCenter.exception.ApiException;
import com.UnionPayCenter.mapper.*;
import com.UnionPayCenter.redis.IRedisService;
import com.UnionPayCenter.service.IConfService;
import com.UnionPayCenter.service.ICouponService;
import com.UnionPayCenter.service.IUserService;
import com.UnionPayCenter.util.*;
import com.UnionPayCenter.vastchain.SmsUtil;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;

/**
 * @Description:
 * @Param:
 * @return:
 * @Author: bite
 * @Date: 2019/4/25
 */
@Service
@Transactional
public class ConfServiceImpl implements IConfService {

    @Autowired
    private IRedisService redisService;
    @Autowired
    private ConfMapper confMapper;

    @Override
    public String getDomainUrl() {
        if(redisService.hasKey(ConstantInterface.DOMAIN_URL)){
            return redisService.getString(ConstantInterface.DOMAIN_URL);
        }
        ConfEntity confEntity = confMapper.selectByKey(ConstantInterface.DOMAIN_URL);
        redisService.setString(ConstantInterface.DOMAIN_URL, confEntity.getConfValue());
        return confEntity.getConfValue();
    }

}
